﻿using System.Collections.Generic;
using System.Windows.Forms;

namespace GeoSketch2.Core
{
    /// <summary>
    /// The toolbar button for the selection tool
    /// </summary>
    public partial class TBBSelection : BaseToolbarButton
    {
        #region Constructor
        /// <summary>
        /// The toolbar button for the selection tool
        /// </summary>
        public TBBSelection()
        {
            InitializeComponent();
            ToolTipText = "Selection";
        } 
        #endregion

        #region Events
        /// <summary>
        /// The event on the mouse click on the button
        /// </summary>
        protected override void OnMouseClick(object sender, MouseEventArgs e)
        {
            foreach (BaseDrawableObject obj in DisplayBox.Viewport.SelectedObjects)
            {
                obj.IsSelected = false;
            }
            DisplayBox.Viewport.SelectedObjects.Clear();
            
            base.OnMouseClick(sender, e);
        }
        #endregion

        #region Properties
        /// <summary>
        /// Gets the tool assigned to the button
        /// </summary>
        protected override BaseTool Tool
        {
            get
            {
                return new TSelection(DisplayBox.Viewport);
            }
        }
        #endregion
    }
}